package com.ruoyi.project.tool.swagger;

import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Ide;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.OperatorType;
import com.ruoyi.framework.security.service.SysLoginService;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.domain.vo.LoginVo;
import io.swagger.annotations.Api;
import org.apache.catalina.security.SecurityUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Security;

@Api("手机端登录")
@RestController
@RequestMapping("/mobile")
public class LoginController {

    @Autowired
    private SysLoginService loginService;

    @PostMapping(value = "/loginMobile")
    @Log(title = "手机端登录", operatorType = OperatorType.MOBILE)
    @Ide
    public AjaxResult login(@RequestBody LoginVo vo)
    {
        // 生成令牌并和用戶基本信息
        SysUser sysUser = loginService.loginMobile(vo.getUsername(),vo.getPassword(),vo.getCaptchaCode(),vo.getCaptchCodeId());
        return AjaxResult.success(sysUser);
    }



}
